//
//  CCDPraseDataModel.m
//  operativeSide
//
//  Created by 王春程 on 16/5/19.
//  Copyright © 2016年 com.caocaod.www. All rights reserved.
//

#import "CCDPraseDataModel.h"

@implementation CCDPraseDataModel

//创建单例模式对象
+ (instancetype)sharedPraseData {
        
        static CCDPraseDataModel *_sharedModel = nil;
        
        static dispatch_once_t onceToken;
        
        dispatch_once(&onceToken, ^{
            _sharedModel = [[CCDPraseDataModel alloc] init];
        });
        return _sharedModel;
}

//进行网络请求
+ (void)getWithUrl:(NSString *)url params:(NSDictionary *)params progressView:(UIProgressView *)progressView successBlock:(SuccessBlock)httpSuccess faithBlock:(FaithBlock)httpFaith {
    [CCDHttpBaseTool getWithPath:url params:params progress:nil success:^(id JSON) {
        httpSuccess(JSON);
    } failure:^(NSError *error) {
        httpFaith(error);
    }];
    
}

+ (void)postWithUrl:(NSString *)url params:(NSDictionary *)params progressView:(UIProgressView *)progressView successBlock:(SuccessBlock)httpSuccess faithBlock:(FaithBlock)httpFaith {
    [CCDHttpBaseTool postWithPath:url params:params progress:nil success:^(id JSON) {
        httpSuccess(JSON);
    } failure:^(NSError *error) {
        httpFaith(error);
    }];
}
@end
